package com.xushan.controller;

import com.xushan.entity.User;
import com.xushan.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Collection;


/**
 * Created by xushan_2 on 2017/5/11.
 */
@Controller
@RequestMapping("/ssm")
public class UserController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired//注入UserService
    private UserService userService;

    @RequestMapping(value = "/test")
    @ResponseBody
    public Collection<User> testSSM(){
        logger.info("测试 spring mvc test ssm");
    return  userService.getUserList();
    }

    @RequestMapping(value = "/hello")
    public String hello(){
        return "hello";
    }
    @RequestMapping(value = "hellossm")
    @ResponseBody
    public String helloSSM(){
        return "helloSSM!";
    }
}
